import {app,BrowserWindow,Menu,ipcMain } from "electron"
import path from 'path'

let win:BrowserWindow | null

Menu.setApplicationMenu(null) // 取消菜单项
const createBrowserWindow = () => {
    win = new BrowserWindow({
        webPreferences: {
            nodeIntegration: true,
            devTools: true,
            contextIsolation: false
        }
    })
    if (process.env["NODE_ENV"] !=="development") {
            win.loadFile(path.join(__dirname,"../index.html"))
    } else {
        win.loadURL(`http://${process.env["VITE_DEV_SERVER_HOST"]}`+ `:${process.env["VITE_DEV_SERVER_PORT"]}`)
    }
   
}

app.whenReady().then(createBrowserWindow)
